package com.bigcat.gulimall.gulimallsearch.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Ather:Yuan
 * @Date:2020/12/16
 * @Desc:1.导入依赖
 * 2.编写配置，给容器注入RestHighLevelClient
 * 3.
 */
@Configuration
public class ElasticSearchConfig{

    @Bean("restHighLevelClient")
    public RestHighLevelClient elasticsearchClient() {
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(RestClient.builder(
                new HttpHost("192.168.20.128", 9200, "http")
        ));
        return restHighLevelClient;
    }
}
